<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>layui</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link href="__LAYUI__/layui/css/layui.css" media="all" rel="stylesheet">
		<link href="__LAYUI__/adminui/dist/css/admin.css" media="all" rel="stylesheet">
	</head>
	{include file="info" /}
	<body>
		<div class="layui-fluid">
			<div class="layui-row layui-col-space15">
				<div class="layui-col-md12">
					<div class="layui-card">
						<div class="layui-card-body">
							<div class="layui-tab">
								<ul class="layui-tab-title">
									{notempty name="$info"}
									{volist name="info" id="vo" key="k"}
									<li lay-id="{$k}" {if $k==1}class="layui-this" {/if}>{$vo.name_cn?:''}</li>
									{/volist}
									{/notempty}
								</ul>
								<div class="layui-tab-content">
									{notempty name="$info"}
									{volist name="info" id="vo" key="k"}
									<div class="layui-tab-item {if $k==1}layui-show{/if}">
										<div class="layui-form layui-form-pane">
											{notempty name="$vo.children"}
											{volist name="vo['children']" id="cvo"}
											<div class="layui-form-item {if $cvo.type==2}layui-form-text{/if}">
												<label class="layui-form-label">{$cvo.name_cn?:''}</label>
												<div class="layui-input-block">
													{if $cvo.type==1}
													<input type="text" name="{$cvo.name?:''}" value="{$cvo.value?:''}"
														placeholder="请输入{$cvo.name_cn?:''}" class="layui-input">
													{/if}
													{if $cvo.type==2}
													<textarea name="{$cvo.name?:''}" class="layui-textarea"
														placeholder="请输入{$cvo.name_cn?:''}">{$cvo.value?:''}</textarea>
													{/if}
													{if $cvo.type==3}
													{notempty name="$cvo.content"}
													{volist name="$cvo['content']" id="xvo" key="kx"}
													<input type="radio" name="{$cvo.name?:''}" value="{$kx-1}" {if
														$kx-1==$cvo.value}checked{/if} class="layui-input"
														title="{$xvo}">
													{/volist}
													{/notempty}
													{/if}
													<!-- {if $cvo.type==4}
													{notempty name="$cvo.content"}
													{volist name="$cvo['content']" id="xvo" key="kx"}
													{php}
													$checkbox=explode(",",$cvo['value']);
													$num=$kx-1;
													if(in_array($num, $checkbox)){
													echo '<input type="checkbox" value="'.$num.'"
														name="'.$cvo['name'].'[]" lay-text="'.$xvo.'" checked>';
													}else{
													echo '<input type="checkbox" value="'.$num.'"
														name="'.$cvo['name'].'[]" lay-text="'.$xvo.'">';
													}
													{/php}
													{/volist}
													{/notempty}
													{/if}
													{if $cvo.type==5}
													{notempty name="$cvo.content"}
													<select name="{$cvo.name?:''}">
														{volist name="$cvo['content']" id="xvo" key="kx"}
														<option value="{$kx-1}" {if $kx-1==$cvo.value}selected{/if}>
															{$xvo}</option>
														{/volist}
													</select>
													{/notempty}
													{/if} -->
												</div>
											</div>
											{/volist}
											<div
												class="layui-form-item {if MyAuto('myadmin','config','myedit')==false}layui-hide{/if}">
												<button class="layui-btn" lay-submit lay-filter="submit"> 保存 </button>
											</div>
											{/notempty}
										</div>
									</div>
									{/volist}
									{/notempty}
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</body>
</html>
<script>
	layui.use(["layer", "jquery", "form"], function() {
		var layer = layui.layer;
		var $ = layui.jquery;
		var form = layui.form;
		form.on("submit(submit)", function(data) {
			var title = $("input[name='title']").val();
			data.field.title = title;
			$.ajax({
				url: "{:url('config/myedit')}",
				data: data.field,
				type: "post",
				success: function(res) {
					if (res.code == 0) {
						top.notify.success(res.msg, "topRight");
					} else {
						top.notify.error(res.msg, "topRight");
					}
				}
			})
			return false;
		})
	});
</script>